-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add description for using code-server as a systemd unit #379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
[Service] | ||
Type=simple | ||
User=<USER> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also set environment file. There is a instance the User environment is not being used by systemd
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please suggest changes as I am not aware of the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User=<USER> | |
User=<USER> | |
EnvironmentFile=$HOME/.profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, see my systemd Unit file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sr229 The Environment file can't work it has wrong formart systemd expects a other formart it will not execute that file with if else statements.
VAR=VALUE
is the only thing that is accepted in it!
Ping @nwtnsqrd |
sr229 suggested to add "EnvironmentFile" for the systemd unit
I updated the PR |
|
||
ExecStart=<PATH TO BINARY> --allow-http | ||
|
||
StandardOutput=file:/var/log/code-server-output.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Ubuntu 16.04 the Standard* options were not recognized. I ended up with the following systemd unit (I anyways prefer logging to go to journald):
[Unit]
Description=VSCode in a browser
After=network.target
[Service]
Type=simple
User=myuser
EnvironmentFile=$HOME/.profile
Restart=on-failure
RestartSec=10
ExecStart=/usr/local/bin/code-server --allow-http --port 1234 --no-auth --disable-telemetry $HOME/dev-workspace
ExecStop=/sbin/start-stop-daemon --stop -x /usr/local/bin/code-server
[Install]
WantedBy=multi-user.target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a more viable alternative is to log this to journald if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should always be logging to journald.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is it chief
This is a very useful doc PR. Having a peer reviewed systemd config file is 💰. My only comment is to add |
@nhooyr We already have it on |
Sounds good. |
This is the same PR but with some fixes for v2. Co-Authored-by: nwtnsqrd <[email protected]> Signed-off-by: Ayane Satomi <[email protected]>
This is the same PR but with some fixes for v2. Co-Authored-by: nwtnsqrd <[email protected]> Signed-off-by: Ayane Satomi <[email protected]>
This is the same PR but with some fixes for v2. Co-Authored-by: nwtnsqrd <[email protected]> Signed-off-by: Ayane Satomi <[email protected]>
Describe in detail the problem you had and how this PR fixes it
I needed this extra piece of information and had to get it from another source. Might be convenient to include it here.
Is there an open issue you can link to?
No.